Don't artificially restrict time precision of ozi reader based on time precision...
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 17 Jul 2013 23:43:48 +0000 (23:43 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 17 Jul 2013 23:43:48 +0000 (23:43 +0000)
gpsbabel/mtk_logger.cc
gpsbabel/ozi.cc
gpsbabel/reference/route/ozi~gpx.gpx

index fd2ff099dec5d22b2c2592c9f646b5761bc011cc..be54d10aa5c0479124860bdd121505f0cc64f32e 100644 (file)
@@ -776,7 +776,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
   }
   trk->creation_time  = itm->timestamp; // in UTC..
   if (bmask & (1<<MILLISECOND)) {
-    trk->microseconds  = MILLI_TO_MICRO(itm->timestamp_ms);
+    trk->creation_time = trk->creation_time.addMSecs(itm->timestamp_ms);
   }
 
   if (bmask & (1<<PDOP)) {
index 3c39c6b61e91a32e16c3e9b4e86ec62fd952db22..f4dc2c574a23754052f22eeac746c44d961a977d 100644 (file)
@@ -161,27 +161,10 @@ ozi_get_time_str(const waypoint *waypointp, char *buff, gbsize_t buffsz)
 void
 ozi_set_time_str(const char *str, waypoint *waypointp)
 {
-  double ozi_time;
-  const char *dot;
-  int len;
-
-  ozi_time = atof(str);
-  waypointp->SetCreationTime((ozi_time - DAYS_SINCE_1990) * SECONDS_PER_DAY);
-
-  dot = strchr(str, '.');
-  /* get number of characters after dot */
-  len = (dot) ? strlen(str) - (dot - str) - 1 : 0;
-  if (len >= 7) {
-    /* with default ozi time precision (%.7f) we can only handle tenths of second */
-    ozi_time -= ((double)waypointp->creation_time / SECONDS_PER_DAY) + DAYS_SINCE_1990;
-    ozi_time *= SECONDS_PER_DAY;
-    waypointp->microseconds = (ozi_time * 10) + 0.5;
-    if (waypointp->microseconds == 10) {
-      waypointp->creation_time++;
-      waypointp->microseconds = 0;
-    }
-    waypointp->microseconds *= 100000;
-  }
+  double ozi_time = atof(str);
+
+  waypointp->SetCreationTime((ozi_time - DAYS_SINCE_1990) * SECONDS_PER_DAY,
+                              1000000 * (ozi_time - (int) ozi_time));
 }
 
 static void
index bec3c65502bbc591ba989f15dd1b69864e3cd72d..5347590f80aaaf0e999249e7986593a761337be0 100644 (file)
@@ -5,13 +5,13 @@
   <rte>
     <name>1 COSTANERO JA</name>
     <rtept lat="-34.445850000" lon="-58.523720000">
-      <time>2010-11-25T20:26:00Z</time>
+      <time>2010-11-25T20:26:00.851Z</time>
       <name>MPCHIC</name>
       <cmt>MARINA PUNTA CHICA</cmt>
       <desc>MARINA PUNTA CHICA</desc>
     </rtept>
     <rtept lat="-34.447380000" lon="-58.507270000">
-      <time>2013-03-11T19:52:37Z</time>
+      <time>2013-03-11T19:52:36.828Z</time>
       <name>JA12</name>
     </rtept>
   </rte>
@@ -25,7 +25,7 @@
       <desc>07-OCT-00 18:22</desc>
     </rtept>
     <rtept lat="-34.477470000" lon="-57.861670000">
-      <time>2012-09-02T00:05:55Z</time>
+      <time>2012-09-02T00:05:55.004Z</time>
       <name>COLBO3W </name>
     </rtept>
   </rte>